package lpg;

import java.util.ArrayList;
import java.util.List;

class ClassnameElement
{
    ClassnameElement(String specifiedName, String realName, VariableSymbol arrayElementTypeSymbol)
    {
        this(specifiedName, realName, arrayElementTypeSymbol, false);
    }

    ClassnameElement(String specifiedName, String realName, VariableSymbol arrayElementTypeSymbol, boolean isTerminalClass)
    {
        this.specifiedName          = specifiedName;
        this.realName               = realName;
        this.arrayElementTypeSymbol = arrayElementTypeSymbol;
        this.isTerminalClass        = isTerminalClass;
    }

    String getAllocationName(int lhsImage)
    {
        for (int i = 0, n = specialArrays.size(); i < n; i++)
        {
            SpecialArrayElement element = specialArrays.get(i);
            if (element.lhsImage == lhsImage)
                return element.name;
        }
        return realName;
    }

    String specifiedName                    = null;
    String realName                         = null;
    boolean isTerminalClass                 = false;
    boolean needsEnvironment                = false;
    VariableSymbol arrayElementTypeSymbol   = null;
    List<SpecialArrayElement> specialArrays = new ArrayList<SpecialArrayElement>();
    IntArrayList rule                       = new IntArrayList();
    IntArrayList ungeneratedRule            = new IntArrayList();
    IntArrayList interfaces                 = new IntArrayList();
    IntArrayList rhsTypeIndex               = new IntArrayList();
    LookupTable<String, Symbol> symbolSet           = new LookupTable<String, Symbol>();

}
